var http = require("http");
var assert = require("assert");

var opts = {
    host: 'localhost',
    path: '/send',
    port: 8888,
    method: 'POST',
    headers: {'content-type':'application/x-www-form-urlencoded'}
}

var request = http.request(opts , function(response){
    response.setEncoding("utf8");

    var data = "";
    response.on('data', function(d){
        data = data + d;
    });

    response.on('end', function(){
        assert.strictEqual(data, '{"status":"ok", "message" : "Tweet received"}');
    });
});

request.write('tweet=test');
request.end();
